Repository navigation
feat(knowledge): a knowledge source needs no adapter and no requires entry; it binds to the deployment's store - #38026
Conversation
…s the service Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…old so; the boot line names the token Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…unts the service and the deployment's store Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…service Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…dapter Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
… no service) to its own card The save-time warn, the reworded boot line and their tests leave this change; row 3a's boot line and behaviour are main's again. The full state is kept on claude/area-o1C-37306-item4 (fa2b538). Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…pter main's boot pass (#37951) read the source's named adapter; a source that names none is now placed through boundAdapterId, and one that cannot be placed is left to the reading, as an unmounted named one is. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
The reconcile (#37979) read a source's named adapter to tell a store that lists no documents; it now reads the store the source is placed on, so a source that names no adapter is walked or left as a named one is. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…wn code A 400 VALIDATION_ERROR from admitAuthoredSource arrived over MCP as SERVICE_UNAVAILABLE with status 400; only a 403 is respelled now. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
📓 Docs Drift CheckThis PR changes 6 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 196 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin bef19fa23959bf5c4fb4cf153a5782957f6d4c7e && git checkout bef19fa23959bf5c4fb4cf153a5782957f6d4c7e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6e2a8f2bb577b9fff5225a1280bc6cbbea680c7c 6881aa6f0b2d357a81c79e34f8b19f417c334c0b && git checkout -B drift-repro 6e2a8f2bb577b9fff5225a1280bc6cbbea680c7c && git merge --no-ff 6881aa6f0b2d357a81c79e34f8b19f417c334c0b
node scripts/docs-audit/affected-docs.mjs --json 6e2a8f2bb577b9fff5225a1280bc6cbbea680c7c
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · head aba523a · 2026-11-27T17:08Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Inputs read: card #37306 (body and all six comments, dev report 7224020195 last), split card #37983 (body, ruling 7220511579, claim, dev report), PR #38026 body and file list, the net diff from merge base ① Derived judgmentsAccept-set and public-surface changes the diff implies, each judged.
Hidden narrowing: none found in what an author can write or in what a deployment runs. Two TypeScript-only tightenings exist on helper types of ② Semver level
③ Boundary flags
④ Design judgment
S1 (should-fix) — Implementing files, sentence by sentence.
Nits. None changes correctness or the contract; a fix that moves a reviewed file is left to a follow-up. N1 — The changeset's "What to do: nothing" omits one case. A stack on 19.0.0-next.1 that ships a source without N2 — The PR body's sentence that CI covers the PostgreSQL acceptance through N3 — N4 — N5 — Two helper types of N6 — #37306's own thread carries no seat line recording the split of item 4; only the dev reports and #37983's body say so, and the card body still lists item 4 and its acceptance line. One seat comment on #37306 naming #37983 and ruling 7220511579 before the merge closes the card (prose face). N7 — Two message details. N8 — The Open on this head: S1. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): REWORK at head 席位核对Contract review. Record 7224273377 at this head: PASS at the contract tier ( S1, confirmed on the tree. Same head, optional prose (record nits):
CI. At 17:16Z, Test Core, Test UI, Type Check (workspace and consumer gates) and the E2E lanes were still running. The next head needs them green. Next: a new head, a delta L2 on S1, a delta L1, then the seat's Tier H handoff (protocol-added). |
The type member had no reader (the spelling map already owns the collection-to-type mapping). The changeset names the one behaviour a next.1 stack shipping a source without requires sees. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…rve does stackItemCapabilities is a composition step of both boots: os migrate plan/apply now composes the knowledge service for a stack that ships a knowledge_source and lists no knowledge token, as os serve mounts it. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · head af27454 · 2026-11-27T19:14Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Delta review of record 7224273377 (head S1 (should-fix): closed No must-fix, no should-fix. ① Derived judgments
② Semver levelUnchanged from record 7224273377: ③ Boundary flags
④ Design judgment
So nothing is opened, embedded, built, scheduled or sent. The service declares no objects, so a plan is the same as before; the one visible difference is that the "Composed what Nits. None changes correctness or the contract. N9 — The changeset's N10 — Two follow-ups are named in the PR body and carry no card: the live PostgreSQL case without Implemented-by: VERDICT: PASS |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · head 6881aa6 · 2026-11-27T19:21Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Second delta, on record 7226372153 (head ① Derived judgmentsThe diff from ② Semver levelUnchanged: ③ Boundary flags
④ Design judgmentNo Remaining nits, all accepted or carried by a card, none touched here: N4 (the unchecked code cast, parity with REST), N5 (two helper-type tightenings, compiler-carried), N7 (two message and placement details), N8 (the No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT (delta) at head 席位核对Gates. Check-runs at 6881aa6: 62 success, 12 expected skip, 0 failed, 0 pending, including Test Core 1 to 10 after the migrate-boot fix. Mergeable state is clean. Contract review. The chain is record 7224273377, then delta 7226372153 (af27454, S1 closed, No must-fix, no should-fix), then delta 7226470829 at this head (prose-only, No must-fix, no should-fix). All at the contract tier, with
Landing: |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Seat record · 2026-11-27T19:51Z · PR #38026 (Fixes #37306) · head 席位核对 — ACCEPT · repo:objectstack#1 · head
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes #37306
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #37310 —
skills/**teaches the optionaladapterand the item mount after this lands维护者速读
What changes
Mechanism (the deployment's-store mark). It is a service option, not a contract member:
KnowledgeServicePlugin/KnowledgeServicetakedeploymentAdapter?: string, which the runtime sets to the adapter id of the store it mounted (resolveCapabilityArgument('knowledge', …)answers{ deploymentAdapter: resolveKnowledgeStore(input).store.adapterId }, the same resolutionresolveCapabilityExtrasmounts from).IKnowledgeAdapterandregisterAdapterare unchanged, so an adapter that application code registers is never the deployment's by registering.adapteroptional (@objectstack/spec, ADR-0161 K4 / K8 item 11).KnowledgeSourceSchema.adapterisz.string().optional(). Omitted, the source is held by the marked store, else the only adapter registered. Several registered and none the deployment's ⇒ refused at registration on both doors (registerSource, theknowledge_sourceloader) and at save (admitAuthoredSource),400 VALIDATION_ERROR, naming the choices. A source registered first and left unplaceable by adapters that came later answers the same refusal at index and search, andreportUnmountedAdaptersnames it once at boot. No adapter at all ⇒503 SERVICE_UNAVAILABLE, naming the marked store.adapterIdFor/adapterFor/boundAdapterId), so a code-door source registered at init finds a store plugin that registers instart(). EverygetAdapter(source.adapter)call site (reindex, index state, record sync, delete, search planning, reap guard,dropMetadataSource) now goes through it.index_statusreports the adapter a source is placed on.PlatformCapabilityProvidergains optionalmountedBy: { collection }; theknowledgerow ofPLATFORM_CAPABILITY_PROVIDERScarries{ collection: 'knowledgeSources' }. (Review S1, record 7224273377: the earliertypemember had no reader and repeated what the spelling map owns, so it is dropped.)@objectstack/coreaddsstackItemCapabilities(stack)(top level, then each package body), andresolveServedCapabilities(…, { itemTokens })serves them as declared tokens, reported in a newbyItemsset.os serve/os dev/os startand verify'sbootStackread it and passdatabaseto the argument resolver.os migrate plan/applycompose the same set:stackItemCapabilitiesis a composition step of both boots inboot-preparation-parity.test.ts. This answers CI's Test Core red at aba523a and the review's N3.knowledge_sourcesaved at run time on a deployment with no knowledge service behaves exactly as on main: row 3a's boot line and behaviour are unchanged. The built item-4 code is kept onclaude/area-o1C-37306-item4(fa2b538).content/docs/ai/knowledge-rag.mdx,content/docs/protocol/knowledge.mdx; references regenerated (gen:docs).What a 19.0.0-next.1 stack sees: one that ships a source without
requires: ['knowledge']held an inert item with a boot warning. It is now indexed: the service mounts, the boot pass builds the index, and the content fields are sent to the configured embedder (ADR-0161 K5: embedding is egress). The changeset says the same.Unchanged: a named adapter that is not mounted answers
SERVICE_UNAVAILABLEas before (#37102); a host that mountsKnowledgeServicePluginitself gets no store and no mark from the runtime; without a source or the token nothing is mounted. Out of scope as fenced:skills/**(#37310), the Studio form (#37309), hosted/EE mounts, #37479's unmounted-adapter reporting.Deviations (declared)
@objectstack/runtime, MCP draft door (packages/runtime/src/domains/mcp-authoring.ts,itemSaveRefusal): a finding from the dev of card knowledge: what a knowledge_source saved at run time does on a deployment that mounted no knowledge service (split from #37306 item 4) #37983, carried here. The door spelled every refusal that was not a 403 asSERVICE_UNAVAILABLE, so the new400 VALIDATION_ERRORfromadmitAuthoredSourcearrived over MCP asSERVICE_UNAVAILABLEwith status 400. Now a 403 staysPERMISSION_DENIEDand any other verdict keeps its own code, as the REST door already does. It carries a pin inmcp-authoring.test.tsand a@objectstack/runtimepatch entry in the changeset. Outside the claimed file surface.@objectstack/cli, the migrate boot (schema-migration-plugins.ts,composeServedPlatform): it reads the item tokens asservedoes. The step pin and a behaviour pin cover it: an item-only stack composesKnowledgeServicePlugin, and the control does not.adapterfield this change makes optional. Both now read the store a source is placed on (boundAdapterId), each with a pin.listDocumentscheck (main's scheduled reconcile), in merge 635fb18.knowledge-service.ts. That PR absorbs the merge after this lands.content/docs/references/ai/knowledge-source.mdx. docs(adr,spec): ADR-0084's notes catch up with the knowledge_source row; the knowledge_source tombstones name the code door #38015 has landed. This head merges main and regenerates the page on the merged tree (gen:schema+gen:docs).File surface beyond the claim, declared:
packages/runtime/src/domains/mcp-authoring.tsand its test,packages/cli/src/utils/schema-migration-plugins.tsand its test plusboot-preparation-parity.test.ts(above), theknowledgeSourcesdescribe inpackages/spec/src/stack.zod.ts,service-knowledgeplugin options,knowledge-build-actions.ts,knowledge-reap-guard.ts,packages/verify/src/required-providers.ts,packages/core/src/capability-providers.ts(comments only).Read first (by risk):
packages/services/service-knowledge/src/knowledge-service.ts:adapterIdForandrefuseUnplacedSource, where the refusal and placement rules live.packages/core/src/capability-composition.ts:stackItemCapabilitiesand theknowledgebranch ofresolveCapabilityArgument.packages/spec/src/kernel/platform-capabilities.ts: themountedByrow field, the public surface this adds.Two-minute verification:
pnpm --filter @objectstack/verify exec vitest run src/harness.required-providers.test.ts -t "an item, no adapter, no token"should print one passing case: a stack with aknowledge_sourcethat names no adapter and norequires: ['knowledge']bootsKnowledgeServicePlugin+KnowledgeTursoPlugin, places the source ontursobeside an app adapter, and finds the Chinese row for住宿标准 报销.Tests
Local, under the shared verify lock, at 633041b (the last commit, af27454, adds only module-top imports to one cli test file; that file was re-run, see below).
Suites and typecheck
@objectstack/spec(whole package): 909 files / 28749 passed (+1 todo).@objectstack/corecapability-composition.test.ts: 25/25.@objectstack/service-knowledge: 18 files / 563 tests.@objectstack/verifyharness.required-providers.test.ts: 16/16.@objectstack/cliboot-preparation-parity.test.ts+schema-migration-plugins.test.ts: 2 files / 93 tests, at 633041b and again at af27454 (cli typecheck exit 0 at both).@objectstack/runtimemcp-authoring.test.ts: 73/73, at aba523a; runtime is unchanged since.Ablations (each restored; blob == HEAD, `git diff HEAD` empty)
adapterIdForresolveServedCapabilitiesknowledgecapability argumentadapteroptional, redone asz.string().min(0)(the first try was a no-op)stackItemCapabilities, core distSERVICE_UNAVAILABLESERVICE_UNAVAILABLEwhereVALIDATION_ERRORwas expectedKnowledgeServicePluginis not composedA5 left with item 4.
Acceptance notes
capability-mount.live-postgres.test.tsnamesadapter: 'pgvector'andrequires: ['knowledge'], so it exercises neither the omitted adapter nor the item mount (review N2).resolveCapabilityArgument('knowledge', postgres)answers{ deploymentAdapter: 'pgvector' }, the storeresolveCapabilityExtrasmounts for the same database (core).adapterandrequires, so it exercises the deployment store and the item mount #38040 dropsadapterandrequiresfrom the live case.os serve --artifact-fallback(no config, the stack synthesized from the artifact JSON) reads items from a config that carries noknowledgeSources. The artifact result surfacesrequiresbut no item collection, so an artifact-only stack's sources do not mount the service there. Follow-up: runtime:os serve --artifact-fallbackmounts the knowledge service for an artifact-only stack's knowledge_source items #38039; not built here.Verification
Container run (os dev, scratch app; at fa2b538, items 1-3 unchanged since)
The scratch app held one
knowledge_source, with noadapterand norequires. The embedder was a local bigram fake.os dev --freshbootedKnowledgeServicePluginandKnowledgeTursoPlugin.os knowledge rebuild kbx-kbx_policiesendeddone: 3 rows read, 3 written.os knowledge statusshowedadapter turso,index: current.search_knowledge '住宿标准 报销'ranked差旅住宿标准first (score 0.436).Gates
dispatch-gates --commandsat 633041b derives 129 families.check:type-check-debt: its closure build needs the shared lock (CI ranType Check · debt ledgergreen at aba523a).check:skill-examplesandcheck:dual-build-cjs-loads: they exit 3 on prerequisites outside this diff (the client-react, studio and scenarios dists are not built).check:generated("All 14 generated artifacts are up to date"),check:api-surface,check:dts-closure,check:i18n*,check:docs-transcript-driftandcheck:nul-bytes.check:test-source-aliasfailed once, on the edited cli test file. The test now pays its dynamic imports at module top, and the gate exits 0.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP